<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>LDA 详解 | 云玩家</title><meta name="keywords" content="数学,机器学习,概率图模型"><meta name="author" content="云玩家"><meta name="copyright" content="云玩家"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="先验知识Gamma 函数 Gamma 函数详解  Beta&#x2F;Dirichlet 分布与共轭 Beta 函数, Beta 分布详解  MCMC, 吉布斯采样这块资料暂时自己去找, 等我有空写了 $\textrm{MCMC}$ 的教程再补上. LDA 介绍构成&amp;nbsp;$\textrm{LDA (Latent Dirichlet Allocation)}$ 是一种词袋模型. 由语料, 文档, 话题.">
<meta property="og:type" content="article">
<meta property="og:title" content="LDA 详解">
<meta property="og:url" content="http://yunist.cn/ML/model/LDA/index.html">
<meta property="og:site_name" content="云玩家">
<meta property="og:description" content="先验知识Gamma 函数 Gamma 函数详解  Beta&#x2F;Dirichlet 分布与共轭 Beta 函数, Beta 分布详解  MCMC, 吉布斯采样这块资料暂时自己去找, 等我有空写了 $\textrm{MCMC}$ 的教程再补上. LDA 介绍构成&amp;nbsp;$\textrm{LDA (Latent Dirichlet Allocation)}$ 是一种词袋模型. 由语料, 文档, 话题.">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://yunist.cn/ML/model/LDA/LDA.png">
<meta property="article:published_time" content="2020-04-23T10:31:09.000Z">
<meta property="article:modified_time" content="2021-08-14T04:39:34.309Z">
<meta property="article:author" content="云玩家">
<meta property="article:tag" content="数学">
<meta property="article:tag" content="机器学习">
<meta property="article:tag" content="概率图模型">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://yunist.cn/ML/model/LDA/LDA.png"><link rel="shortcut icon" href="/img/favicon.ico"><link rel="canonical" href="http://yunist.cn/ML/model/LDA/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//s4.cnzz.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script async="async" data-pjax="data-pjax" src="https://s4.cnzz.com/z_stat.php?id=1278869595&amp;web_id=1278869595"></script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script src="/js/yuntools.js"></script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-14 12:39:34'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cnyist/blog/css/font.css"><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/cnyist/blog/img/avatar.svg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">97</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">40</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">27</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/chat/"><i class="fa-fw fas fa-comments"></i><span> 闲聊室</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-user"></i><span> about</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw iconfont icon-Web"></i><span> 镜像站点</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" target="_blank" rel="noopener" href="https://yunist.gitee.io"><i class="fa-fw iconfont icon-gitee-fill-round"></i><span> Gitee Pages</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/ML/model/LDA/LDA.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">云玩家</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/chat/"><i class="fa-fw fas fa-comments"></i><span> 闲聊室</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-user"></i><span> about</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw iconfont icon-Web"></i><span> 镜像站点</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" target="_blank" rel="noopener" href="https://yunist.gitee.io"><i class="fa-fw iconfont icon-gitee-fill-round"></i><span> Gitee Pages</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">LDA 详解</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-04-23T10:31:09.000Z" title="发表于 2020-04-23 18:31:09">2020-04-23</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-14T04:39:34.309Z" title="更新于 2021-08-14 12:39:34">2021-08-14</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/%E6%A8%A1%E5%9E%8B/">模型</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/ML/model/LDA/#post-comment"><span id="twikoo-count"></span></a></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="先验知识"><a href="#先验知识" class="headerlink" title="先验知识"></a>先验知识</h1><h2 id="Gamma-函数"><a href="#Gamma-函数" class="headerlink" title="Gamma 函数"></a>Gamma 函数</h2><ul>
<li><a href="https://yunist.cn/math/probability_theory/gamma/">Gamma 函数详解</a></li>
</ul>
<h2 id="Beta-Dirichlet-分布与共轭"><a href="#Beta-Dirichlet-分布与共轭" class="headerlink" title="Beta/Dirichlet 分布与共轭"></a>Beta/Dirichlet 分布与共轭</h2><ul>
<li><a href="https://yunist.cn/math/probability_theory/beta/">Beta 函数, Beta 分布详解</a></li>
</ul>
<h2 id="MCMC-吉布斯采样"><a href="#MCMC-吉布斯采样" class="headerlink" title="MCMC, 吉布斯采样"></a>MCMC, 吉布斯采样</h2><p>这块资料暂时自己去找, 等我有空写了 $\textrm{MCMC}$ 的教程再补上.</p>
<h1 id="LDA-介绍"><a href="#LDA-介绍" class="headerlink" title="LDA 介绍"></a>LDA 介绍</h1><h2 id="构成"><a href="#构成" class="headerlink" title="构成"></a>构成</h2><p>&nbsp;$\textrm{LDA (Latent Dirichlet Allocation)}$ 是一种词袋模型. 由<strong>语料</strong>, <strong>文档</strong>, <strong>话题</strong>. <strong>词</strong>, 这三个概念组成.</p>
<ul>
<li><p>语料</p>
<p>语料是文档的集合.</p>
</li>
<li><p>文档</p>
<p>文档是词的集合, 可以看做是一篇作文, 或是像这篇一样的博文, 反正就是一篇完整的文本.</p>
</li>
<li><p>话题</p>
<p>话题给出了某个词出现的概率. 到底是啥呢? $\textrm{LDA}$ 认为, 文档中每个词都应该有它的话题, 词是由话题来生成的. 比如说某个词的话题是 “概率论” , 那么这个词就很有可能是 “$\textrm{Gamma}$ 函数” , 而不太可能是 “吃饭” . “可能” 与 “不太可能” 在数学上用概率描述, 而话题就给出了这个概率的值. </p>
</li>
<li><p>词</p>
</li>
<li><p>这应该无需多解释, “词” 本身就是一个词. 文档是由一个个词组成的</p>
</li>
</ul>
<h2 id="生成文档过程"><a href="#生成文档过程" class="headerlink" title="生成文档过程"></a>生成文档过程</h2><p>生成文本的过程, 就像是上帝抛骰子. 关于这个骰子如何抛, 频率派与贝叶斯派有不同的解释, 而 $\textrm{LDA}$ 就是基于贝叶斯派的解释. </p>
<h3 id="频率派"><a href="#频率派" class="headerlink" title="频率派"></a>频率派</h3><p>频率派认为, 上帝有两种骰子, 一种是 $\textrm{doc-topic}$ 骰子, 它有 $K$ 个面, 每个面都是一个 $\textrm{topic}$ 的编号. 还有一种是 $\textrm{topic-word}$ 骰子, 一共有 $K$ 个, 正好对应 $\textrm{doc-topic}$ 的 $K$ 个面. 每个 $\textrm{topic-word}$ 骰子有 $V$ 个面, 每一个面都对应一个词. 生成文档包括两个过程:抛投  骰子, 得到一个  编号.</p>
<ol>
<li>抛投 $\textrm{doc-topic}$ 骰子, 得到一个 $\textrm{topic}$ 编号.</li>
<li>按照这个 $\textrm{topic}$ 编号, 找到对应的 $\textrm{topic-word}$ 骰子, 再次抛投, 生成一个词.</li>
</ol>
<p>假如说一个文档有 $N$ 个词, 那么以上过程就重复 $N$ 次, 这样就生成了这篇文档所有的词, 这篇文档也就生成完毕.</p>
<h3 id="贝叶斯派"><a href="#贝叶斯派" class="headerlink" title="贝叶斯派"></a>贝叶斯派</h3><p>对于这样的抛骰子过程, 贝叶斯派可就不满意了. 无论是 $\textrm{doc-topic}$ 骰子, 还是 $\textrm{topic-word}$ 骰子, 都是模型里的参数, 参数都是随机变量, 怎么能没有先验呢?</p>
<p>于是, 就有了两大缸骰子, 一缸装了 $\textrm{doc-topic}$ 骰子, 一缸装了 $\textrm{topic-word}$ 骰子, 相比频率派, 贝叶斯派多了 $1,2$ 两个过程.</p>
<ol>
<li>从 $\textrm{topic-word}$ 缸中取出 $K$ 个 $\textrm{topic-word}$ 骰子, 每个 $\textrm{topic-word}$ 骰子有 $V$ 个面, 每一个面都对应一个词.</li>
<li>从 $\textrm{doc-topic}$ 缸中取出一个 $\textrm{doc-topic}$ 骰子, 所有的 $\textrm{doc-topic}$ 骰子都只有 $K$ 个面.</li>
<li>抛投 $\textrm{doc-topic}$ 骰子, 得到一个 $\textrm{topic}$ 编号.</li>
<li>按照这个 $\textrm{topic}$ 编号, 找到对应的 $\textrm{topic-word}$ 骰子, 再次抛投, 生成一个词. 如果一篇文档所有的词没有生成完毕, 那么就跳到第 $3$ 点继续重复生成词.</li>
</ol>
<p>执行完这 $4,$$ 个过程一篇文档就生成完成, 然后重新回到 $2,$$ , 生成下一篇文档 (也就是说 $K,$$ 个 $\textrm{topic-word},$$ 骰子不用重新抽取), 直到整个语料 (包含 $M,$$ 篇文档) 生成完毕, 也就是重复 $M,$$ 次. <strong>每篇文档都是独立的, 每个词也是, 所以生成的过程可以互相交换.</strong></p>
<h2 id="目标"><a href="#目标" class="headerlink" title="目标"></a>目标</h2><p>&nbsp;$\textrm{LDA}$ 的目标就是给定文档 然后估计文档中每个词的 $\textrm{topic}$ , 以及估计出你取到的 $\textrm{doc-topic}$ 骰子与 $\textrm{topic-word}$ 骰子到底是长啥样 (每个面的概率) . 我们这里将某篇文档的 $\textrm{doc-topic}$ 骰子记为 $\vec{\theta}_m$ , 整个语料中的 $\textrm{doc-topic}$ 骰子记为 $\vec{\theta}_1,\dots,\vec{\theta}_M$ . $\vec\theta_m$ 向量的每个分量的值就是取到某个 $\textrm{topic}$ 编号的概率. 而 $K$ 个 $\textrm{topic-word}$ 骰子记为 $\vec\varphi_1, \vec\varphi_2,\dots,\vec\varphi_K$ . 我们的目的就是求出 $\varphi_1, \varphi_2,\dots,\varphi_K$ 与 $\vec{\theta}_1,\dots,\vec{\theta}_M$. 我们再将每篇文档中的词记为 $\vec{w}$ , 整个语料 $\mathcal{W}$ 包含 $M$ 篇文档记为 $\vec{\boldsymbol{\mathrm{w}}}=(\vec{w}_1,\dots\vec{w}_M)$ , 所有的 $\textrm{word}$ 对应的 $\textrm{topic}$ 记为 $\boldsymbol{\vec{\mathrm{z}}}=(\vec{z}_1,\dots\vec{z}_M)$ .</p>
<h2 id="先验分布"><a href="#先验分布" class="headerlink" title="先验分布"></a>先验分布</h2><p>由于 $\textrm{topic}$ 与 $\textrm{word}$ 的数量服从 $\textrm{Multinomial}$ 分布, 很自然就把骰子的分布设为与其共轭的 $\textrm{Dirichlet}$ 分布. 于是有<br>$$<br>p(\vec\theta_m\mid\vec{\alpha})=Dir(\vec\theta_m\mid \vec{\alpha})\\<br>p(\vec\varphi_k\mid\vec{\beta})=Dir(\vec\varphi_k\mid\vec{\beta})\\<br>p(\vec n_m\mid\vec\theta_m)= Mult(\vec n_m\mid\vec\theta_m)\\<br>p(\vec n_k\mid\vec z_m,\varphi)=Mult(\vec n_k\mid \vec z_m,\varphi)<br>$$<br>其中 $\vec\alpha, \vec\beta$ 是 $\textrm{Dirichlet}$ 分布的参数, 求取前就已经确定, $\varphi=(\vec\varphi_1, \vec\varphi_2,\dots,\vec\varphi_K)$ , $N_m$ 是第 $m$ 篇文档中词的数量.  $\vec{n}_m=(\vec{n}_m^{(1)},\dots,\vec{n}_m^{(K)})$ , 它的分量 $\vec{n}_m^{(k)}$ 代表第 $m$ 篇文档中第 $k$ 个 $\textrm{topic}$ 产生的词的数量. $\vec{n}_k=(\vec{n}_k^{(1)},\dots,\vec{n}_k^{(V)})$ , $\vec n_k^{(v)}$ 表示第 $k$ 个 $\textrm{topic}$ 产生的词中 $\mathrm{word};v$ 的个数. 当然这里表述有点不严谨, 因为都用的是字母 $n$ , 只是根据下标区别.</p>
<h2 id="联合分布"><a href="#联合分布" class="headerlink" title="联合分布"></a>联合分布</h2><p>这里注意到, 整个 $\textrm{LDA}$ 过程就是 $(M+K)$ 个 $\textrm{Dirichlet-Multinomial}$ 共轭.<br>$$<br>p(\vec{\boldsymbol{\mathrm{w}}}, \boldsymbol{\vec{\mathrm{z}}}\mid\vec{\alpha},\vec{\beta})=p(\vec{\boldsymbol{\mathrm{w}}}\mid \boldsymbol{\vec{\mathrm{z}}},\vec{\beta})p(\boldsymbol{\vec{\mathrm{z}}}\mid \vec{\alpha})<br>$$<br>现在我们要分别求出 $p(\vec{\boldsymbol{\mathrm{w}}}\mid \boldsymbol{\vec{\mathrm{z}}},\vec{\beta})$ , 与 $p(\boldsymbol{\vec{\mathrm{z}}}\mid \vec{\alpha})$ .这里设. 那么有<br>$$<br>\begin{aligned}<br>p(\boldsymbol{\vec{\mathrm{z}}}\mid \vec{\alpha})&amp;=\prod_{m=1}^Mp(\vec{z}<em>m\mid\vec{\alpha})\\<br>&amp;=\prod</em>{m=1}^M\int p(\vec{z}<em>m\mid\vec{\theta}<em>m)p(\vec{\theta}_m\mid\vec{\alpha}),\rm{d}\vec{\theta}_m\\<br>&amp;=\prod</em>{m=1}^M\int p(\vec{z}_m\mid\vec{\theta}_m) Dir(\vec\theta_m\mid \vec{\alpha}),\rm{d}\vec{\theta}_m\\<br>&amp;=\prod</em>{m=1}^M\int \prod_{k=1}^K{\left(\vec{\theta}<em>m^{(k)}\right)}^{\vec{n}<em>m^{(k)}}\frac{1}{\Delta(\vec{\alpha})} \prod</em>{k=1}^K{\left(\vec{\theta}<em>m^{(k)}\right)}^{\alpha_v-1},\mathrm{d}\vec{\theta}_m\\<br>&amp;=\prod</em>{m=1}^M\frac{1}{\Delta(\vec{\alpha})}\int \prod</em>{k=1}^K{\left(\vec{\theta}<em>m^{(k)}\right)}^{\vec{n}<em>m^{(k)}+\alpha_v-1} ,\mathrm{d}\vec{\theta}_m\\<br>&amp;=\prod</em>{m=1}^M\frac{\Delta(\vec{n}<em>m+\vec{\alpha})}{\Delta(\vec{\alpha})}<br>\end{aligned}<br>$$<br>上式已经给出了 $M$ 个 $\textrm{Dirichlet-Multinomial}$ 共轭. 其中 $\Delta(\vec\alpha)$ 是归一化因子, 也可以看做是高维的 $\textrm{Beta}$ 函数. (本来还想根据规律称其为狄利克雷函数, 但是这个名字已经被占用了) .<br>$$<br>\Delta(\vec\alpha)=\int\prod</em>{k=1}^K{\left(\vec{\theta}_m^{(k)}\right)}^{\alpha_k-1},\mathrm{d}\vec{\theta}_m<br>$$<br>还记得我上面提到的吗, 由于<strong>每篇文档都是独立的, 每个词也是, 所以生成的过程可以互相交换.</strong> 那么在每个词的 $\textrm{topic}$ (也就是 $\vec{\varphi}$ 与 $\vec{z}_m$) 已经生成的条件下, 可以将语料中的词进行交换, 将相同 $\textrm{topic}$ 的词放在一起生成<br>$$<br>\vec{\boldsymbol{\mathrm{w}}}’=(\vec{w}</em>{(1)},\dots\vec{w}<em>{(K)})\\<br>\boldsymbol{\vec{\mathrm{z}}}’=(\vec{z}</em>{(1)},\dots\vec{z}<em>{(K)})<br>$$<br>因此有<br>$$<br>\begin{aligned}<br>p(\vec{\boldsymbol{\mathrm{w}}}\mid \boldsymbol{\vec{\mathrm{z}}},\vec{\beta})&amp;=p(\vec{\boldsymbol{\mathrm{w}}}’\mid \boldsymbol{\vec{\mathrm{z}}}’,\vec{\beta})\\<br>&amp;=\prod</em>{k=1}^Kp(\vec{w}<em>{(k)}\mid\vec{z}</em>{(k)}, \vec\beta)\\<br>&amp;=\prod_{k=1}^K\int p(\vec w_{(k)}\mid\vec z_{(k)},\vec\varphi_k)p(\vec\varphi_k\mid\vec{\beta}),\mathrm{d}\vec\varphi_k\\<br>&amp;=\prod_{k=1}^K\int \prod_{v=1}^V\left({\vec\varphi_k^{(v)}}\right)^{\vec n_k^{(v)}}\frac{1}{\Delta(\vec{\beta})}\prod_{v=1}^V\left({\vec\varphi_k^{(v)}}\right)^{\vec\beta_v-1},\mathrm{d}\vec\varphi_k\\<br>&amp;=\prod_{k=1}^K\frac{1}{\Delta(\vec{\beta})}\int \prod_{v=1}^V\left({\vec\varphi_k^{(v)}}\right)^{\vec n_k^{(v)}+\vec\beta_v-1},\mathrm{d}\vec\varphi_k\\<br>&amp;=\prod_{k=1}^K\frac{\Delta(\vec{n}<em>k+\vec{\beta})}{\Delta(\vec{\beta})}<br>\end{aligned}<br>$$<br>&nbsp;$\Delta(\beta),$$ 同样是归一化因子<br>$$<br>\Delta(\beta)=\int \prod</em>{v=1}^V\left({\vec\varphi_k^{(v)}}\right)^{\vec\beta_v-1},\mathrm{d}\vec\varphi_k<br>$$<br>最终有<br>$$<br>\begin{aligned}<br>p(\vec{\boldsymbol{\mathrm{w}}}, \boldsymbol{\vec{\mathrm{z}}}\mid\vec{\alpha},\vec{\beta})&amp;=p(\vec{\boldsymbol{\mathrm{w}}}\mid \boldsymbol{\vec{\mathrm{z}}},\vec{\beta})p(\boldsymbol{\vec{\mathrm{z}}}\mid \vec{\alpha})\\<br>&amp;=\prod_{k=1}^K\frac{\Delta(\vec{n}<em>k+\vec{\beta})}{\Delta(\vec{\beta})}\prod</em>{m=1}^M\frac{\Delta(\vec{n}_m+\vec{\alpha})}{\Delta(\vec{\alpha})}<br>\end{aligned}<br>$$<br>多么简洁漂亮!</p>
<h2 id="吉布斯采样"><a href="#吉布斯采样" class="headerlink" title="吉布斯采样"></a>吉布斯采样</h2><p>我们要估计的是 $p(\boldsymbol{\vec{\mathrm{z}}}\mid\vec{\boldsymbol{\mathrm{w}}})$ , 根据吉布斯采样的要求, 我们要求出 $p(z_i\mid\boldsymbol{\vec{\mathrm{z}}}<em>{-i},\vec{\boldsymbol{\mathrm{w}}})$ .<br>$$<br>p(z_i=k\mid\boldsymbol{\vec{\mathrm{z}}}_{-i},\vec{\boldsymbol{\mathrm{w}}})p(w_i=v\mid\boldsymbol{\vec{\mathrm{z}}}_{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i})=p(z_i=k,w_i=v\mid\boldsymbol{\vec{\mathrm{z}}}<em>{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i})<br>$$<br>注意到 $p(w_i=t\mid\boldsymbol{\vec{\mathrm{z}}}<em>{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i})$ 与 $p(z_i=k\mid\boldsymbol{\vec{\mathrm{z}}}<em>{-i},\vec{\boldsymbol{\mathrm{w}}})$ 无关, 因此有<br>$$<br>p(z_i=k\mid\boldsymbol{\vec{\mathrm{z}}}_{-i},\vec{\boldsymbol{\mathrm{w}}})\propto p(z_i=k,w_i=v\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i})<br>$$<br>那么就有<br>$$<br>\begin{aligned}<br>p(z_i=k\mid\boldsymbol{\vec{\mathrm{z}}}_{-i},\vec{\boldsymbol{\mathrm{w}}})&amp;\propto p(z_i=k,w_i=v\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i})\\<br>&amp;=\left(\int p(z_i=k,\vec\theta_m\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i}),\mathrm{d}\vec\theta_m\right)\left(\int p(w_i=v,\vec{\varphi}<em>k\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i}),\mathrm{d\vec\varphi_k}\right)\\<br>&amp;=\left(\int p(z_i=k\mid\vec{\theta}<em>m)p(\vec\theta_m\mid\boldsymbol{\vec{\mathrm{z}}}_{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i}),\mathrm{d}\vec\theta_m\right)\left(\int p(w_i=v\mid \vec\varphi_k)p(\vec{\varphi}<em>k\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i}),\mathrm{d\vec\varphi_k}\right)<br>\end{aligned}<br>$$<br>注意到 $p(\vec\theta_m\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i})$ 是一个 $\textrm{Dirichlet-Multinomial}$ 共轭结构即<br>$$<br>Dir(\vec\theta_m\mid\vec\alpha)+Mult(\vec n_m\mid \vec\theta_m)=Dir(\vec\theta_m\mid\vec n_m+\vec\alpha)<br>$$<br>所以<br>$$<br>p(\vec\theta_m\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i})=Dir(\vec\theta_m\mid\vec n_{m,-i}+\vec\alpha)<br>$$<br>&nbsp;$p(\vec{\varphi}<em>k\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i})$ 也有类似的结论. 因此有<br>$$<br>\begin{aligned}<br>p(z_i=k\mid\boldsymbol{\vec{\mathrm{z}}}<em>{-i},\vec{\boldsymbol{\mathrm{w}}})&amp;\propto \left(\int p(z_i=k\mid\vec{\theta}_m)p(\vec\theta_m\mid\boldsymbol{\vec{\mathrm{z}}}_{-i},\vec{\boldsymbol{\mathrm{w}}}</em>{-i}),\mathrm{d}\vec\theta_m\right)\left(\int p(w_i=v\mid \vec\varphi_k)p(\vec{\varphi}<em>k\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}}<em>{-i}),\mathrm{d\vec\varphi_k}\right)\\<br>&amp;=\left(\int \theta_{mk} Dir(\vec\theta_m\mid\vec n_{m,-i}+\vec\alpha),\mathrm{d}\vec\theta_m\right)\left(\int \varphi_{kv}Dir(\vec\varphi_k\mid\vec n_{k,-i}+\vec\beta),\mathrm{d\vec\varphi_k}\right)\\<br>&amp;=E(\theta_{mk})E(\varphi</em>{kv})\\<br>&amp;=\hat{\theta}<em>{mk}\hat{\varphi}</em>{kv}<br>\end{aligned}<br>$$<br>根据 $\textrm{Dirichlet}$ 分布的期望, 我们得到<br>$$<br>\hat{\theta}<em>{mk}=\frac{\vec{n}</em>{m,-i}^{(k)}+\alpha_k}{\sum_{k=1}^K(\vec{n}<em>{m,-i}^{(k)}+\alpha_k)}\\<br>\hat{\varphi}_{kv}=\frac{\vec{n}</em>{k,-i}^{(v)}+\alpha_k}{\sum_{v=1}^V(\vec{n}<em>{k,-i}^{(v)}+\alpha_k)}<br>$$<br>因此<br>$$<br>p(z_i=k\mid\boldsymbol{\vec{\mathrm{z}}}</em>{-i},\vec{\boldsymbol{\mathrm{w}}})\propto\frac{\vec{n}<em>{m,-i}^{(k)}+\alpha_k}{\sum_{k=1}^K(\vec{n}</em>{m,-i}^{(k)}+\alpha_k)}\cdot\frac{\vec{n}<em>{k,-i}^{(v)}+\alpha_k}{\sum_{v=1}^V(\vec{n}</em>{k,-i}^{(v)}+\alpha_k)}<br>$$<br>通过吉布斯采样, 我们就可以估计出 $\varphi_1, \varphi_2,\dots,\varphi_K$ 与 $\vec{\theta}_1,\dots,\vec{\theta}_M$ 了.</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">云玩家</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://yunist.cn/ML/model/LDA/">http://yunist.cn/ML/model/LDA/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://yunist.cn" target="_blank">云玩家</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%95%B0%E5%AD%A6/">数学</a><a class="post-meta__tags" href="/tags/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a><a class="post-meta__tags" href="/tags/%E6%A6%82%E7%8E%87%E5%9B%BE%E6%A8%A1%E5%9E%8B/">概率图模型</a></div><div class="post_share"><div class="social-share" data-image="/ML/model/LDA/LDA.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><!-- - var pagination_cover = prev.cover === false ? prev.randomcover : prev.cover--><a href="/scribble/obsessive_LaTeX/"><img class="prev-cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/obsessive_LaTeX/obsessive_LaTeX.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">强迫症的 LaTeX</div></div></a></div><!-- - var pagination_cover = next.cover == false ? next.randomcover : next.cover--><div class="next-post pull-right"><a href="/hexo/valine_admin/"><img class="next-cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/hexo/valine_admin/valine_admin.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Valine 评论回复增强</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/ML/watermelon_book/read/14/" title="读懂西瓜书 14 : 概率图模型"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/ML/watermelon_book/read/14/14.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-03-22</div><div class="title">读懂西瓜书 14 : 概率图模型</div></div></a></div><div><a href="/scribble/obsessive_LaTeX/" title="强迫症的 LaTeX"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/obsessive_LaTeX/obsessive_LaTeX.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-23</div><div class="title">强迫症的 LaTeX</div></div></a></div><div><a href="/math/linear_algebra/geometric_det/" title="行列式几何意义的证明"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/linear_algebra/geometric_det/geometric_det.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-30</div><div class="title">行列式几何意义的证明</div></div></a></div><div><a href="/math/linear_algebra/prove_1/" title="线性代数命题证明 (一)"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/linear_algebra/prove_1/prove_1.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-06-05</div><div class="title">线性代数命题证明 (一)</div></div></a></div><div><a href="/math/set_theory/unique_ordinal/" title="序数的唯一性"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/set_theory/unique_ordinal/unique_ordinal.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-01-12</div><div class="title">序数的唯一性</div></div></a></div><div><a href="/math/probability_theory/beta/" title="Beta 函数, Beta 分布详解"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/probability_theory/beta/beta.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-13</div><div class="title">Beta 函数, Beta 分布详解</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/cnyist/blog/img/avatar.svg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">云玩家</div><div class="author-info__description">云玩家's blog</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">97</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">40</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">27</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/cnyist" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/chnyist" target="_blank" title="CSDN"><i class="fas iconfont icon-CN_csdnnet"></i></a><a class="social-icon" href="https://www.zhihu.com/people/cnyist" target="_blank" title="知乎"><i class="fas iconfont icon-zhihu"></i></a><a class="social-icon" href="mailto:yunist@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%88%E9%AA%8C%E7%9F%A5%E8%AF%86"><span class="toc-number">1.</span> <span class="toc-text">先验知识</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Gamma-%E5%87%BD%E6%95%B0"><span class="toc-number">1.1.</span> <span class="toc-text">Gamma 函数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Beta-Dirichlet-%E5%88%86%E5%B8%83%E4%B8%8E%E5%85%B1%E8%BD%AD"><span class="toc-number">1.2.</span> <span class="toc-text">Beta&#x2F;Dirichlet 分布与共轭</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#MCMC-%E5%90%89%E5%B8%83%E6%96%AF%E9%87%87%E6%A0%B7"><span class="toc-number">1.3.</span> <span class="toc-text">MCMC, 吉布斯采样</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#LDA-%E4%BB%8B%E7%BB%8D"><span class="toc-number">2.</span> <span class="toc-text">LDA 介绍</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9E%84%E6%88%90"><span class="toc-number">2.1.</span> <span class="toc-text">构成</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%9F%E6%88%90%E6%96%87%E6%A1%A3%E8%BF%87%E7%A8%8B"><span class="toc-number">2.2.</span> <span class="toc-text">生成文档过程</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%A2%91%E7%8E%87%E6%B4%BE"><span class="toc-number">2.2.1.</span> <span class="toc-text">频率派</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%B4%9D%E5%8F%B6%E6%96%AF%E6%B4%BE"><span class="toc-number">2.2.2.</span> <span class="toc-text">贝叶斯派</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%9B%AE%E6%A0%87"><span class="toc-number">2.3.</span> <span class="toc-text">目标</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%88%E9%AA%8C%E5%88%86%E5%B8%83"><span class="toc-number">2.4.</span> <span class="toc-text">先验分布</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%81%94%E5%90%88%E5%88%86%E5%B8%83"><span class="toc-number">2.5.</span> <span class="toc-text">联合分布</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%90%89%E5%B8%83%E6%96%AF%E9%87%87%E6%A0%B7"><span class="toc-number">2.6.</span> <span class="toc-text">吉布斯采样</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/set_theory/unique_ordinal/" title="序数的唯一性"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/set_theory/unique_ordinal/unique_ordinal.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="序数的唯一性"/></a><div class="content"><a class="title" href="/math/set_theory/unique_ordinal/" title="序数的唯一性">序数的唯一性</a><time datetime="2022-01-12T08:26:12.000Z" title="发表于 2022-01-12 16:26:12">2022-01-12</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/3/3-1/" title="(史济怀) 数学分析教程上册第 3 版-练习题 3.1"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/3/3-1/math.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 3.1"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/3/3-1/" title="(史济怀) 数学分析教程上册第 3 版-练习题 3.1">(史济怀) 数学分析教程上册第 3 版-练习题 3.1</a><time datetime="2021-10-19T00:30:55.000Z" title="发表于 2021-10-19 08:30:55">2021-10-19</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-11/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.11"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/2/2-11/2-11.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 2.11"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-11/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.11">(史济怀) 数学分析教程上册第 3 版-练习题 2.11</a><time datetime="2021-09-25T03:37:28.000Z" title="发表于 2021-09-25 11:37:28">2021-09-25</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-10/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.10"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/2/2-10/2-10.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 2.10"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-10/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.10">(史济怀) 数学分析教程上册第 3 版-练习题 2.10</a><time datetime="2021-09-22T07:36:49.000Z" title="发表于 2021-09-22 15:36:49">2021-09-22</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-9/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.9"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/2/2-9/2-9.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 2.9"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-9/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.9">(史济怀) 数学分析教程上册第 3 版-练习题 2.9</a><time datetime="2021-09-20T08:19:06.000Z" title="发表于 2021-09-20 16:19:06">2021-09-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By 云玩家</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer><script>document.getElementById('web_bg').style = 'background-image: url("' + get_rand_jsd_pic('cnyist', 'banner@master', '/', 70, '-min.jpg') + '")'</script></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    loader: {
      source: {
        '[tex]/amsCd': '[tex]/amscd'
      }
    },
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        addClass: [200,() => {
          document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
            const target = node.parentNode
            if (!target.classList.contains('has-jax')) {
              target.classList.add('mathjax-overflow')
            }
          })
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><script>(()=>{
  const $countDom = document.getElementById('twikoo-count')
  const init = () => {
    let initData = {
      el: '#twikoo-wrap',
      envId: 'yunist-147dfe',
      region: ''
    }

    if (false) {
      const otherData = false
      initData = Object.assign(initData, otherData)
    }
    
    twikoo.init(initData)
  }

  const getCount = () => {
    twikoo.getCommentsCount({
      envId: 'yunist-147dfe',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      $countDom.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const loadTwikoo = (bool = false) => {
    if (typeof twikoo === 'object') {
      init()
      bool && $countDom && setTimeout(getCount,0)
    } else {
      getScript('https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js').then(()=> {
        init()
        bool && $countDom && setTimeout(getCount,0)
      })
    }
  }

  if ('Twikoo' === 'Twikoo' || !false) {
    if (false) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo(true)
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>